function WeatherHistoryMan(){
	var awsStations = [];
	var show = false;
	function initData(){
		$.getJSON("/rest/awsStation/getAllAwsStation",function(result){
			//[id,城市名，省名，经度，纬度，高度]
			awsStations = result;
			drawStation();
		});
	}
	this.show = function(){
		if(awsStations.length==0){
			initData();
		}else{
			drawStation();
		}
	};
	function drawStation(){
		show = true;
		clearAll();
		var gif = "/resources/img/awsStation9.gif";
		var heatPoints = [];
		var circles = [];
		for(var i in awsStations){
			var as = awsStations[i];
			heatPoints[i] = new SuperMap.Feature.Vector(
					new SuperMap.Geometry.Point(as.lon,as.lat),
					null,
					{
						externalGraphic: gif,
						graphicWidth:6,
						graphicHeight: 10,
						graphicOpacity:0.9,
					}
			);
			heatPoints[i].data.type="weatherHistory";
			var centerPoint=new SuperMap.Geometry.Point(as.lon,as.lat);
			var circleP=createCircle(centerPoint,50,256,360,0);
			var circleVector= new SuperMap.Feature.Vector(circleP);
			circleVector.style={
					fill:true,
					stroke:true,
					strokeColor:"#CAFF70",
					fillColor:"pink",
					strokeWidth:0.6,
					fillOpacity:0.2,
					label:'\n'+as.sname,
					fontSize:'0px',
					fontColor:'red'
			};
			circles[i] = circleVector;
			circles[i].attributes.type="weatherHistoryCircle";
		}
		weatherLayer.addFeatures(heatPoints);
		weatherLayer.addFeatures(circles);
		weatherLayer.setVisibility(true);
		selectFeature.activate();
	}
	function initTab(){
		
	}
	//[Point 中心点，半径公里数，边数，扇形角度，相对于中心点偏移角度]
	function createCircle(origin, radius, sides,r,angel){
		//rR r*3.14/(180*边数)
		var rR = r*Math.PI/(180*sides);
		var rotatedAngle, x, y;
		var points = [];
		//算出纬度半径
		var yradius = radius/111;
		//经度半径
		var xradius = yradius/Math.cos(origin.y/180*Math.PI);
		for(var i=0; i<sides; ++i) {
			rotatedAngle = rR*i;
			x = origin.x + (xradius * Math.cos(rotatedAngle));
			y = origin.y + (yradius * Math.sin(rotatedAngle));
			points.push(new SuperMap.Geometry.Point(x, y));
		}
		rotatedAngle = r*Math.PI/180;
		x = origin.x + (xradius * Math.cos(rotatedAngle));
		y = origin.y + (yradius * Math.sin(rotatedAngle));
		points.push(new SuperMap.Geometry.Point(x, y));

		var ring = new SuperMap.Geometry.LinearRing(points);
		ring.rotate(parseFloat(angel),origin);
		var geo = new SuperMap.Geometry.Collection([ring]);
		/*geo.origin = origin;
		geo.radius = radius;
		geo.r = r;
		geo.angel = angel;
		geo.sides = sides;
		geo.polygonType = "Curve";*/
		return geo;
	}
	this.zoom = function(level){
		if(show == false){
			return;
		}
		var features = weatherLayer.getFeaturesByAttribute('type','weatherHistoryCircle');
		if(features == null || features.length == 0){
			show = false;
			return;
		}
		if(level>=9 && features[0].style.fontSize == "0px"){
			for(var i=0;i<features.length;i++){
				features[i].style.fontSize = "12px";
			}
		}
		if(level<9 && features[0].style.fontSize == "12px"){
			for(var i=0;i<features.length;i++){
				features[i].style.fontSize = "0px";
			}
		}
	};
	initData();
}
